<template>
  <view class="hot-shop">
    <view class="hot" v-for="(item, index) in HotShopList" :key="index">
      <navigator
        :url="`/pages/hot/hot?type=${item.type}`"
        open-type="navigate"
        hover-class="navigator-hover"
      >
        <view class="hot-title">
          <view class="title">{{ item.title }}</view>
          <view class="desc">{{ item.alt }}</view>
        </view>
        <view class="hot-pic">
          <image
            v-for="pic in item.pictures"
            :key="pic"
            class="pic"
            :src="pic"
            mode="scaleToFill"
          />
        </view>
      </navigator>
    </view>
  </view>
</template>
<script setup lang="ts">
import type { HotShopItem } from '@/types/home.d.ts'
defineProps<{
  HotShopList: HotShopItem[]
}>()
</script>

<style lang="scss" scoped>
.hot-shop {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 508rpx;
  margin: 20rpx 20rpx 0;
  border-radius: 10rpx;
  background-color: #fff;
  .hot {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 50%;
    height: 254rpx;
    border-right: 1rpx solid #eee;
    border-top: 1rpx solid #eee;
    // 偶数个 2、4
    &:nth-child(2n) {
      border-right: 0 none;
    }
    // 前两个1、2
    &:nth-child(-n + 2) {
      border-top: 0 none;
    }
    .hot-title {
      display: flex;
      align-items: center;
      padding: 24rpx 24rpx 0;
      font-size: 32rpx;
      color: #262626;
      position: relative;
      justify-content: start;
      .desc {
        font-size: 24rpx;
        color: #7f7f7f;
        margin-left: 18rpx;
      }
    }
    .hot-pic {
      display: flex;
      justify-content: space-around;
      .pic {
        width: 150rpx;
        height: 150rpx;
      }
    }
  }
}
</style>
